import { ref, computed } from 'vue';
import { defineStore } from 'pinia';

export const useMenuStore = defineStore('menu', () => {
    // state--折叠状态
    let isCollapsed = ref(false);

    // getters
    let icon = computed(() => isCollapsed.value ? 'Expand' : 'Fold');

    // actions--折叠菜单
    let toggle = () => {
        isCollapsed.value = !isCollapsed.value;
    };
    return {
        isCollapsed,
        icon,
        toggle,
    }
});
